package com.zyl.Ecs.common.domain.auth.ext;

import com.baomidou.mybatisplus.annotation.TableName;
import com.zyl.Ecs.common.domain.auth.bean.Permission;
import com.zyl.Ecs.common.domain.auth.vo.PermissionVO;
import com.zyl.Ecs.common.utils.CUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * @version v1.0
 * @ProjectName: Ecs
 * @Package: com.zyl.Ecs.auth.domain.dto
 * @ClassName: PermissionDto
 * @Description TODO (权限扩展类)
 * @Author 翟玉龙
 * @Date 2024/12/4-16:58
 */
@Data
@SuperBuilder
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "base_permission")
public class PermissionExt extends Permission {

    public static PermissionExt toExt(Permission permission) {
        return CUtil.copyBean(permission, PermissionExt.class);
    }

    public static PermissionExt toExt(PermissionVO permissionVO) {
        return PermissionExt.builder()
                .id(permissionVO.getId())
                .name(permissionVO.getName())
                .key(permissionVO.getKey())
                .path(permissionVO.getPath())
                .build();
    }
}
